<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="../css/public.css">
</head>

<body>
    <!-- setTransform  把当前的变换矩阵重置为单位矩阵，然后以相同的参数运行 transform()。 -->

    <canvas id="myCanvas1" width="300" height="150" style="border:1px solid #d3d3d3;"></canvas>

    <script>
        var a = document.getElementById('myCanvas1');
        var atx = a.getContext('2d');
        atx.fillStyle = "yellow";
        atx.fillRect(0, 0, 250, 100)
        atx.setTransform(1, 0.5, -0.5, 1, 30, 10);
        atx.fillStyle = "red";
        atx.fillRect(0, 0, 250, 100);
        atx.setTransform(1, 0.5, -0.5, 1, 30, 10);
        atx.fillStyle = "blue";
        atx.fillRect(0, 0, 250, 100);
    </script>
</body>

</html>